package com.gc.server.vo.down;


import lombok.Data;
import java.util.Date;
import com.alibaba.excel.annotation.*;
import java.io.Serializable;



import com.gc.server.entity.BookEntity;
import com.gc.server.vo.BookVo;

                                        import com.gc.server.enums.BookStatusEnum;

/**
 * 绘本实体
 * 表名 book
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Tue Oct 27 10:38:33 CST 2020
 */
@Data
public class BookDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

                        //
            @ExcelProperty("")
            private Long id;
        
                        //作者
            @ExcelProperty("作者")
            private String author;
        
                        //文件名
            @ExcelProperty("文件名")
            private String fileName;
        
                        //标题
            @ExcelProperty("标题")
            private String title;
        
                        //简介
            @ExcelProperty("简介")
            private String content;
        
                        //投票数
            @ExcelProperty("投票数")
            private Integer ticket;
        
                        //IMG-封面
            @ExcelProperty("IMG-封面")
            private String img;
        
                        //分类
            @ExcelProperty("分类")
            private Integer type;
        
                        //上传时间
            @ExcelProperty("上传时间")
            private Date time;
        
                        //ENUM-状态:"DOWN-下架","UP-上架"
            @ExcelIgnore
            private Integer status;
                        @ExcelProperty("状态")
            private String statusStr;
        
    
    public BookDown() {

    }

    public BookDown(BookVo vo) {
        BookEntity entity = vo.getEntity();
                                    this.setId(entity.getId());
            
                                    this.setAuthor(entity.getAuthor());
            
                                    this.setFileName(entity.getFileName());
            
                                    this.setTitle(entity.getTitle());
            
                                    this.setContent(entity.getContent());
            
                                    this.setTicket(entity.getTicket());
            
                                    this.setImg(entity.getImg());
            
                                    this.setType(entity.getType());
            
                                    this.setTime(entity.getTime());
            
                                    this.setStatus(entity.getStatus());
                if(entity.getStatus()!=null){
                    this.setStatusStr( BookStatusEnum.indexOf(entity.getStatus()));
                }
            
            }


}
